export enum OrderStatus {
  ALL = -1,     // 全部
  WAIT_ACCEPT = 0,           // Corresponds to '待收样'
  PENDING = 1,                // Corresponds to '进行中'
  WAIT_CONFIRMATION = 2,     // Corresponds to '待确认'
  WAIT_PAYMENT = 3,          // NEW: Corresponds to '待支付' - Choose an appropriate unique number
  FINISHED = 4,              // Corresponds to '已完结'
  CANCELLED = 11,             // Corresponds to '已取消'
  REFUSE = 10,             // Corresponds to '已取消'
  // Other potential status codes
}

export const OrderStatusInfo = {
  [OrderStatus.ALL]: {
    text: '全部',
    color: 'black',
  },
  [OrderStatus.WAIT_ACCEPT]: {
    text: '待取样',
    color: 'green',
    icon: 'logistics',
  },
  [OrderStatus.PENDING]: {
    text: '进行中',
    color: 'orange',
    icon: 'underway',
  },
  [OrderStatus.WAIT_CONFIRMATION]: {
    text: '待确认',
    color: 'blue',
    icon: 'pending-payment',
  },
  [OrderStatus.WAIT_PAYMENT]: {
    text: '待支付',
    color: 'red',
    icon: 'cash-o',
  },
  [OrderStatus.FINISHED]: {
    text: '已完结',
    color: 'red',
    icon: 'success',
  },
  [OrderStatus.REFUSE]: {
    text: '已拒绝',
    color: 'red',
  },
  [OrderStatus.CANCELLED]: {
    text: '已取消',
    color: 'red',
  },

  // 其他状态
};

export interface OrderStatusInfoType {
  text: string;
  color: string;
  icon?: string;
}

export function getOrderStatusStyle(status: OrderStatus | null | undefined): OrderStatusInfoType {
  if (status === null || status === undefined) {
    return {text: '未知状态', color: '#969799'};
  }
  return OrderStatusInfo[status] || {text: `未知状态`, color: '#969799'};
}
